Skip to content

Support schema-aware context publish in Go SDK#10

Open
jiangpengcheng wants to merge 11 commits into
mainfrom
codex/context-publish-schema
Open

Support schema-aware context publish in Go SDK#10
jiangpengcheng wants to merge 11 commits into
mainfrom
codex/context-publish-schema

Conversation

@jiangpengcheng

Copy link
Copy Markdown
Member

Summary

  • add PublishSchema to the context protobuf API
  • add FunctionContext.PublishWithSchema for publishing already-encoded payloads with schema metadata
  • keep existing Publish raw-bytes behavior unchanged
  • add tests for raw publish and schema-aware publish metadata

Tests

  • go test ./...
  • go test ./... in examples/

@jiangpengcheng jiangpengcheng requested a review from a team as a code owner July 14, 2026 13:27

@freeznet freeznet left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: schema-aware context publish

Well-scoped change. The generated context.pb.go looks like a clean protoc regeneration (consistent msgTypes / goTypes / depIdxs, NumMessages 12 → 14, exporters shifted correctly), Publish keeps its raw-bytes behavior, and the new unit tests cover both the raw and schema-aware paths with a capture stub. A couple of inline points on public-API consistency and runtime compatibility — neither is a hard blocker.

Non-blocking notes:

  • .ci/helm.sh ci::verify_total_processed: good fix changing the match from *"$total" to *" ${total}" — the old suffix match would false-positive (e.g. total=1 matching a metric value of 121).
  • Example decodeStudent relies on trial-and-error decoding across two Avro schemas. Binary Avro isn't self-describing, so decoding with the wrong schema can succeed with garbage instead of erroring. It's fine here since CI asserts exact output values (grade+1), just flagging the latent fragility for anyone copying the example.

Comment thread pf/context.go Outdated
Comment thread context.proto

@freeznet freeznet left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review of "Refine context publish schema API" (fca7030)

Both points from the previous pass are resolved — thanks for the quick turnaround:

  • API consistency ✅ — PublishWithSchema now takes a hand-written value struct PublishMessageSchema (with SchemaData back to string) and maps to the wire proto internally via publishMessageSchemaToProto, mirroring the SinkSchema pattern and keeping the generated type off the public surface. Example and unit test are updated accordingly, and there are no lingering references to the old pointer signature.
  • Runtime compatibility ✅ — the PublishWithSchema godoc now documents that a runner consuming PulsarMessage.schema is required (referencing generic-runtime#42) and that older runners silently ignore the proto3 field.

One optional minor note inline. LGTM otherwise.

Comment thread pf/context.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants